<template>
    <div>
        <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>资产管理</el-breadcrumb-item>
            <el-breadcrumb-item>资产管理</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card>
          <h3 style="text-align: left;border-bottom:1px solid gainsboro;padding-bottom: 5px;font-size: 20px">资产管理</h3>

          <p style="text-align: left;padding-top: 20px">账户余额</p>

          <p style="text-align: left;font-size: 30px">{{this.totalRevenue}}</p>



        </el-card>


      <el-card style="margin-top: 30px">
        <p style="text-align: left;font-size: 20px">收支明细</p>
        <el-table :data="incomeDetailsList" border stripe>
          <el-table-column label="时间" prop="insertTime"></el-table-column>
          <el-table-column label="收支类型" prop="revenueType"></el-table-column>
          <el-table-column label="金额(元)" prop="amountNum"></el-table-column>
          <el-table-column label="账单类型" prop="billType"></el-table-column>
          <el-table-column label="账单摘要" prop="billSummary"></el-table-column>
          <el-table-column label="订单号" prop="orderNumber"></el-table-column>
        </el-table>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageNum"
            :page-sizes="[5, 10 , 15, 20]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
        ></el-pagination>



        </el-card>




    </div>
</template>
<script>
    export default {
        data() {
            return {
                pageNum: 1,
                pageSize: 5,
                total: 0,
                incomeDetailsList:[],
                totalRevenue:0,

            };
        },
        methods: {
          getTotalRevenue(){
            let url = "revenue/getTotalRevenue";
            this.$axios.get(url).then(res=>{
              if (res.data.code == 200){
                console.log(res)
                this.totalRevenue = res.data.data;
              }else {
                this.$message({
                  type:"error",
                  message:res.data.msg,
                  duration:1000
                })
              }
            });
          },
          getIncomeDetails(){
            let url = "revenue/queryRevenueRecord";
            this.$axios.get(url,{
              params:{
                now:this.pageNum,
                size:this.pageSize
              }
            }).then(res=>{
              if (res.data.code == 200){
                this.incomeDetailsList = res.data.data.list;
                this.pageNum = res.data.data.pageNum;
                this.pageSize = res.data.data.pageSize;
                this.total = res.data.data.total;
              }else {
                this.$message({
                  type:"error",
                  message:res.data.msg,
                  duration:1000
                })
              }
            });

          },
          handleSizeChange(newSize){
            this.pageSize=newSize;
            this.getIncomeDetails();
          },
          handleCurrentChange(newPage){
            this.pageNum = newPage;
            this.getIncomeDetails();
          },
            reloadData() {
              this.getIncomeDetails();
              this.getTotalRevenue();
            }
        },
        created() {
            this.reloadData();
        }
    };
</script>
<style lang="less" scoped>
</style>